package com.ruoyi.project.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dyun.tool.mybatis.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.dreamlu.mica.core.validation.CreateGroup;
import net.dreamlu.mica.core.validation.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 用户表 sys_user
 *
 * @author dy
 */
@TableName("sys_user")
@EqualsAndHashCode(callSuper = true)
@Data
public class SysUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 用户名
     */
    @NotBlank(message = "用户账号不能为空", groups = {CreateGroup.class, UpdateGroup.class})
    @Size(max = 30, message = "用户账号长度不能超过30个字符")
    private String userName;

    /**
     * 密码
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    /**
     * 昵称
     */
    @Size(max = 30, message = "用户昵称长度不能超过30个字符")
    private String nickName;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 手机
     */
    @Size(max = 11, message = "手机号码长度不能超过11个字符", groups = {CreateGroup.class, UpdateGroup.class})
    private String phone;

    /**
     * 邮箱
     */
    @Size(max = 50, message = "邮箱长度不能超过50个字符", groups = {CreateGroup.class, UpdateGroup.class})
    private String email;

    /**
     * 生日
     */
    private Date birthday;

    /**
     * 性别
     */
    private Integer sex;


    /**
     * 租户ID
     */
    private Long tenantId;

    /**
     * 用户类别
     */
    private Integer socialCode;

    /**
     * 最后登陆IP
     */
    private String loginIp;

    /**
     * 最后登陆时间
     */
    private Date loginDate;

    /**
     * 备注
     */
    private String remark;

    /**
     * 扩展信息
     */
    @TableField(exist = false)
    private Map<String, Object> extension = new HashMap<>();
}
